﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing {
    import flash.events.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.utils.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.dnd.*;
    import org.aswing.event.*;
    import org.aswing.graphics.*;
    import org.aswing.util.*;

    public class Component extends AWSprite {

        private static const bg_trigger_brush:SolidBrush = new SolidBrush(new ASColor(0, 0));

        private static var MAX_CLICK_INTERVAL:int = 400;

        protected var ui:ComponentUI;
        var container:Container;
        private var clientProperty:HashMap;
        private var awmlID:String;
        private var awmlIndex:Number;
        private var awmlNamespace:String;
        private var clipBounds:IntRectangle;
        private var alignmentX:Number;
        private var alignmentY:Number;
        private var minimumSize:IntDimension;
        private var maximumSize:IntDimension;
        private var preferredSize:IntDimension;
        private var cachePreferSizes:Boolean;
        private var cachedPreferredSize:IntDimension;
        private var cachedMinimumSize:IntDimension;
        private var cachedMaximumSize:IntDimension;
        private var constraints:Object;
        private var uiElement:Boolean;
        protected var drawTransparentTrigger:Boolean = true;
        protected var valid:Boolean;
        protected var bounds:IntRectangle;
        protected var readyToPaint:Boolean;
        private var background:ASColor;
        private var foreground:ASColor;
        private var mideground:ASColor;
        private var styleTune:StyleTune;
        private var styleProxy:Component;
        private var backgroundDecorator:GroundDecorator;
        private var foregroundDecorator:GroundDecorator;
        private var font:ASFont;
        private var fontValidated:Boolean;
        private var opaque:Boolean;
        private var opaqueSet:Boolean;
        private var border:Border;
        private var enabled:Boolean;
        private var focusable:Boolean;
        private var focusableSet:Boolean;
        private var toolTipText:String;
        private var dragEnabled:Boolean;
        private var dropTrigger:Boolean;
        private var dragAcceptableInitiator:Dictionary;
        private var dragAcceptableInitiatorAppraiser:Function;
        private var resizerMargin:Insets;
        private var lastClickTime:int;
        private var _lastClickPoint:IntPoint;
        private var clickCount:int;
        private var pressingPoint:IntPoint;

        public function Component(){
            super(true);
            this.setName("Component");
            this.ui = null;
            this.clientProperty = null;
            this.alignmentX = 0;
            this.alignmentY = 0;
            this.bounds = new IntRectangle();
            this.opaque = false;
            this.opaqueSet = false;
            this.valid = false;
            this.enabled = true;
            this.focusable = false;
            this.focusableSet = false;
            this.cachePreferSizes = true;
            this.fontValidated = false;
            this.readyToPaint = false;
            this.toolTipText = null;
            this.uiElement = false;
            this.border = DefaultEmptyDecoraterResource.INSTANCE;
            this.backgroundDecorator = DefaultEmptyDecoraterResource.INSTANCE;
            this.foregroundDecorator = DefaultEmptyDecoraterResource.INSTANCE;
            this.font = DefaultEmptyDecoraterResource.DEFAULT_FONT;
            this.background = DefaultEmptyDecoraterResource.DEFAULT_BACKGROUND_COLOR;
            this.foreground = DefaultEmptyDecoraterResource.DEFAULT_FOREGROUND_COLOR;
            this.mideground = DefaultEmptyDecoraterResource.DEFAULT_MIDEGROUND_COLOR;
            this.styleTune = DefaultEmptyDecoraterResource.DEFAULT_STYLE_TUNE;
            addEventListener(FocusEvent.FOCUS_IN, this.__focusIn);
            addEventListener(FocusEvent.FOCUS_OUT, this.__focusOut);
            addEventListener(MouseEvent.MOUSE_DOWN, this.__mouseDown);
            addEventListener(MouseEvent.CLICK, this.__mouseClick);
            addEventListener(Event.ADDED, this.__componentAdded);
            AsWingUtils.weakRegisterComponent(this);
        }
        private function __componentAdded(_arg1:Event):void{
            var _local2:DisplayObject;
            if (this.isUIElement()){
                _local2 = (_arg1.target as DisplayObject);
                if (_local2 != null){
                    if (_local2 != this){
                        if (AsWingUtils.getOwnerComponent(_local2.parent) == this){
                            this.makeAllTobeUIElement((_arg1.target as DisplayObject));
                        };
                    };
                };
            };
        }
        private function makeAllTobeUIElement(_arg1:DisplayObject):void{
            var _local2:Component;
            var _local3:DisplayObjectContainer;
            var _local4:int;
            if (_arg1 == null){
                return;
            };
            if ((_arg1 is Component)){
                _local2 = (_arg1 as Component);
                _local2.uiElement = true;
            };
            if ((_arg1 is DisplayObjectContainer)){
                _local3 = (_arg1 as DisplayObjectContainer);
                _local4 = (_local3.numChildren - 1);
                while (_local4 >= 0) {
                    this.makeAllTobeUIElement(_local3.getChildAt(_local4));
                    _local4--;
                };
            };
        }
        public function setAwmlID(_arg1:String):void{
            this.awmlID = _arg1;
        }
        public function getAwmlID():String{
            return (this.awmlID);
        }
        public function setAwmlNamespace(_arg1:String):void{
            this.awmlNamespace = _arg1;
        }
        public function getAwmlNamespace():String{
            return (this.awmlNamespace);
        }
        public function setAwmlIndex(_arg1:Number):void{
            this.awmlIndex = _arg1;
        }
        public function getAwmlIndex():Number{
            return (this.awmlIndex);
        }
        public function getUIClassID():String{
            return ("ComponentUI");
        }
        public function setName(_arg1:String):void{
            this.name = _arg1;
        }
        public function getName():String{
            return (name);
        }
        public function updateUI():void{
        }
        public function isUIElement():Boolean{
            return (this.uiElement);
        }
        public function setUIElement(_arg1:Boolean):void{
            if (this.uiElement != _arg1){
                this.uiElement = _arg1;
                if (_arg1){
                    this.makeAllTobeUIElement(this);
                };
            };
        }
        public function getDefaultBasicUIClass():Class{
            return (null);
        }
        public function setUI(_arg1:ComponentUI):void{
            if (this.ui != null){
                this.ui.uninstallUI(this);
            };
            this.ui = _arg1;
            if (this.ui != null){
                this.ui.installUI(this);
            };
            this.revalidate();
            this.repaint();
        }
        public function getUI():ComponentUI{
            return (this.ui);
        }
        public function setBorder(_arg1:Border):void{
            if (_arg1 != this.border){
                if (((!((this.border == null))) && (!((this.border.getDisplay(this) == null))))){
                    removeChild(this.border.getDisplay(this));
                };
                this.border = _arg1;
                if (((!((this.border == null))) && (!((this.border.getDisplay(this) == null))))){
                    addChildAt(this.border.getDisplay(this), getLowestIndexAboveBackground());
                };
                this.repaint();
                this.revalidate();
            };
        }
        public function getBorder():Border{
            return (this.border);
        }
        public function getInsets():Insets{
            if (this.border == null){
                return (new Insets());
            };
            return (this.border.getBorderInsets(this, this.getSize().getBounds()));
        }
        public function setResizerMargin(_arg1:Insets):void{
            if (this.resizerMargin != _arg1){
                this.resizerMargin = _arg1;
                this.revalidate();
                this.repaint();
            };
        }
        public function getResizerMargin():Insets{
            var _local1:Insets = this.resizerMargin;
            if (_local1 == null){
                return (new InsetsUIResource());
            };
            if ((_local1 is UIResource)){
                return (new InsetsUIResource(_local1.top, _local1.left, _local1.bottom, _local1.right));
            };
            return (new Insets(_local1.top, _local1.left, _local1.bottom, _local1.right));
        }
        public function setBackgroundDecorator(_arg1:GroundDecorator):void{
            var _local2:*;
            if (_arg1 != this.backgroundDecorator){
                _local2 = this.backgroundDecorator;
                this.backgroundDecorator = _arg1;
                if (_arg1 != null){
                    setBackgroundChild(_arg1.getDisplay(this));
                } else {
                    setBackgroundChild(null);
                };
                dispatchEvent(new PropertyChangeEvent("backgroundDecorator", _local2, _arg1));
            };
        }
        public function getBackgroundDecorator():GroundDecorator{
            return (this.backgroundDecorator);
        }
        public function setForegroundDecorator(_arg1:GroundDecorator):void{
            var _local2:*;
            if (_arg1 != this.foregroundDecorator){
                _local2 = this.backgroundDecorator;
                this.foregroundDecorator = _arg1;
                if (_arg1 != null){
                    setForegroundChild(_arg1.getDisplay(this));
                } else {
                    setForegroundChild(null);
                };
                dispatchEvent(new PropertyChangeEvent("foregroundDecorator", _local2, _arg1));
            };
        }
        public function getForegroundDecorator():GroundDecorator{
            return (this.foregroundDecorator);
        }
        protected function set d_visible(_arg1:Boolean):void{
            super.visible = _arg1;
        }
        protected function get d_visible():Boolean{
            return (super.visible);
        }
        override public function set visible(_arg1:Boolean):void{
            this.setVisible(_arg1);
        }
        override public function get visible():Boolean{
            return (super.visible);
        }
        public function setVisible(_arg1:Boolean):void{
            if (_arg1 != this.d_visible){
                this.d_visible = _arg1;
                if (_arg1){
                    dispatchEvent(new AWEvent(AWEvent.SHOWN, false, false));
                } else {
                    dispatchEvent(new AWEvent(AWEvent.HIDDEN, false, false));
                };
                if (_arg1){
                    this.repaint();
                };
                this.revalidate();
            };
        }
        public function isVisible():Boolean{
            return (this.visible);
        }
        public function isOnStage():Boolean{
            return (!((stage == null)));
        }
        public function isShowing():Boolean{
            if (((this.isOnStage()) && (this.isVisible()))){
                if (parent == stage){
                    return (true);
                };
                if (this.getParent() != null){
                    return (this.getParent().isShowing());
                };
                return (AsWingUtils.isDisplayObjectShowing(parent));
            };
            return (false);
        }
        public function setFont(_arg1:ASFont):void{
            if (this.font != _arg1){
                this.font = _arg1;
                this.setFontValidated(false);
                this.repaint();
                this.revalidate();
            };
        }
        public function isFontValidated():Boolean{
            return (this.fontValidated);
        }
        public function setFontValidated(_arg1:Boolean):void{
            this.fontValidated = _arg1;
        }
        public function getFont():ASFont{
            if (((!((this.font == null))) && (!((this.font == DefaultEmptyDecoraterResource.NULL_FONT))))){
                return (this.font);
            };
            if (this.getStyleProxy() != null){
                return (this.getStyleProxy().getFont());
            };
            return (DefaultEmptyDecoraterResource.NULL_FONT);
        }
        public function setBackground(_arg1:ASColor):void{
            if (this.background != _arg1){
                this.background = _arg1;
                this.repaint();
            };
        }
        public function getBackground():ASColor{
            if (((!((this.background == null))) && (!((this.background == DefaultEmptyDecoraterResource.NULL_COLOR))))){
                return (this.background);
            };
            if (this.getStyleProxy() != null){
                return (this.getStyleProxy().getBackground());
            };
            return (DefaultEmptyDecoraterResource.NULL_COLOR);
        }
        public function setForeground(_arg1:ASColor):void{
            if (this.foreground != _arg1){
                this.foreground = _arg1;
                this.repaint();
            };
        }
        public function getForeground():ASColor{
            if (((!((this.foreground == null))) && (!((this.foreground == DefaultEmptyDecoraterResource.NULL_COLOR))))){
                return (this.foreground);
            };
            if (this.getStyleProxy() != null){
                return (this.getStyleProxy().getForeground());
            };
            return (DefaultEmptyDecoraterResource.NULL_COLOR);
        }
        public function setMideground(_arg1:ASColor):void{
            if (this.mideground != _arg1){
                this.mideground = _arg1;
                this.repaint();
            };
        }
        public function getMideground():ASColor{
            if (((!((this.mideground == null))) && (!((this.mideground == DefaultEmptyDecoraterResource.NULL_COLOR))))){
                return (this.mideground);
            };
            if (this.getStyleProxy() != null){
                return (this.getStyleProxy().getMideground());
            };
            return (DefaultEmptyDecoraterResource.NULL_COLOR);
        }
        public function setStyleTune(_arg1:StyleTune):void{
            if (this.styleTune != _arg1){
                this.styleTune = _arg1;
                this.repaint();
            };
        }
        public function getStyleTune():StyleTune{
            if (((!((this.styleTune == null))) && (!((this.styleTune == DefaultEmptyDecoraterResource.NULL_STYLE_TUNE))))){
                return (this.styleTune);
            };
            if (this.getStyleProxy() != null){
                return (this.getStyleProxy().getStyleTune());
            };
            return (DefaultEmptyDecoraterResource.NULL_STYLE_TUNE);
        }
        public function setStyleProxy(_arg1:Component):void{
            this.styleProxy = _arg1;
        }
        public function getStyleProxy():Component{
            if (this.styleProxy != null){
                return (this.styleProxy);
            };
            if (this.getParent() != null){
                return (this.getParent());
            };
            if ((parent is Component)){
                return (Component(parent));
            };
            return (null);
        }
        public function setOpaque(_arg1:Boolean):void{
            this.setOpaqueSet(true);
            if (this.opaque != _arg1){
                this.opaque = _arg1;
                this.repaint();
            };
        }
        public function isOpaque():Boolean{
            return (this.opaque);
        }
        public function isOpaqueSet():Boolean{
            return (this.opaqueSet);
        }
        public function setOpaqueSet(_arg1:Boolean):void{
            this.opaqueSet = _arg1;
        }
        public function setAlpha(_arg1:Number):void{
            this.alpha = _arg1;
        }
        public function getAlpha():Number{
            return (alpha);
        }
        public function getMousePosition():IntPoint{
            return (new IntPoint(mouseX, mouseY));
        }
        public function getPaintBounds():IntRectangle{
            return (this.getInsets().getInsideBounds(this.getPaintBoundsInRoot()));
        }
        public function setComBounds(_arg1:IntRectangle):void{
            this.setLocationXY(_arg1.x, _arg1.y);
            this.setSizeWH(_arg1.width, _arg1.height);
        }
        public function setComBoundsXYWH(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
            this.setLocationXY(_arg1, _arg2);
            this.setSizeWH(_arg3, _arg4);
        }
        override public function getBounds(_arg1:DisplayObject):Rectangle{
            return (super.getBounds(_arg1));
        }
        public function getComBounds(_arg1:IntRectangle=null):IntRectangle{
            if (_arg1 != null){
                _arg1.setRect(this.bounds);
                return (_arg1);
            };
            return (new IntRectangle(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height));
        }
        public function setLocation(_arg1:IntPoint):void{
            var _local2:IntPoint = this.bounds.getLocation();
            if (!_arg1.equals(_local2)){
                this.bounds.setLocation(_arg1);
                this.locate();
                dispatchEvent(new MovedEvent(_local2, _arg1));
            };
        }
        public function setLocationXY(_arg1:int, _arg2:int):void{
            this.setLocation(new IntPoint(_arg1, _arg2));
        }
        public function setGlobalLocation(_arg1:IntPoint):void{
            var _local2:Point = parent.globalToLocal(new Point(_arg1.x, _arg1.y));
            this.setLocationXY(_local2.x, _local2.y);
        }
        public function setGlobalLocationXY(_arg1:int, _arg2:int):void{
            this.setGlobalLocation(new IntPoint(_arg1, _arg2));
        }
        public function getLocation(_arg1:IntPoint=null):IntPoint{
            if (_arg1 != null){
                _arg1.setLocationXY(this.bounds.x, this.bounds.y);
                return (_arg1);
            };
            return (new IntPoint(this.bounds.x, this.bounds.y));
        }
        public function getGlobalLocation(_arg1:IntPoint=null):IntPoint{
            var _local2:Point = localToGlobal(new Point(0, 0));
            if (_arg1 != null){
                _arg1.setLocationXY(_local2.x, _local2.y);
                return (_arg1);
            };
            return (new IntPoint(_local2.x, _local2.y));
        }
        public function globalToComponent(_arg1:IntPoint):IntPoint{
            var _local2:Point = new Point(_arg1.x, _arg1.y);
            _local2 = globalToLocal(_local2);
            return (new IntPoint(_local2.x, _local2.y));
        }
        public function componentToGlobal(_arg1:IntPoint):IntPoint{
            var _local2:Point = new Point(_arg1.x, _arg1.y);
            _local2 = localToGlobal(_local2);
            return (new IntPoint(_local2.x, _local2.y));
        }
        public function setBounds(_arg1:IntRectangle):void{
            this.setComBounds(_arg1);
        }
        public function setSize(_arg1:IntDimension):void{
            _arg1.width = Math.max(0, _arg1.width);
            _arg1.height = Math.max(0, _arg1.height);
            var _local2:IntDimension = new IntDimension(this.bounds.width, this.bounds.height);
            if (!_arg1.equals(_local2)){
                this.bounds.setSize(_arg1);
                this.size();
                dispatchEvent(new ResizedEvent(_local2, _arg1));
            };
        }
        public function setSizeWH(_arg1:int, _arg2:int):void{
            this.setSize(new IntDimension(_arg1, _arg2));
        }
        public function getSize(_arg1:IntDimension=null):IntDimension{
            if (_arg1 != null){
                _arg1.setSizeWH(this.bounds.width, this.bounds.height);
                return (_arg1);
            };
            return (new IntDimension(this.bounds.width, this.bounds.height));
        }
        public function pack():void{
            this.setSize(this.getPreferredSize());
        }
        public function setWidth(_arg1:int):void{
            this.setSizeWH(_arg1, this.getHeight());
        }
        public function setHeight(_arg1:Number):void{
            this.setSizeWH(this.getWidth(), _arg1);
        }
        public function getWidth():int{
            return (this.bounds.width);
        }
        public function getHeight():int{
            return (this.bounds.height);
        }
        public function setX(_arg1:int):void{
            this.setLocationXY(_arg1, this.getY());
        }
        public function setY(_arg1:int):void{
            this.setLocationXY(this.getX(), _arg1);
        }
        public function getX():int{
            return (this.bounds.x);
        }
        public function getY():int{
            return (this.bounds.y);
        }
        public function setEnabled(_arg1:Boolean):void{
            if (this.enabled != _arg1){
                this.enabled = _arg1;
                mouseEnabled = _arg1;
                this.repaint();
            };
        }
        public function isEnabled():Boolean{
            return (this.enabled);
        }
        public function setClipBounds(_arg1:IntRectangle):void{
            if ((((_arg1 == null)) && ((this.clipBounds == null)))){
                return;
            };
            var _local2:Boolean;
            if ((((_arg1 == null)) && (!((this.clipBounds == null))))){
                this.clipBounds = null;
                _local2 = true;
            } else {
                if (!_arg1.equals(this.clipBounds)){
                    this.clipBounds = _arg1.clone();
                    _local2 = true;
                };
            };
            if (_local2){
                this.layoutClipAndTrigger(null);
            };
        }
        public function getClipBounds():IntRectangle{
            if (this.clipBounds == null){
                return (null);
            };
            return (this.clipBounds.clone());
        }
        public function setClipSize(_arg1:IntDimension):void{
            var _local2:IntRectangle = new IntRectangle();
            if (this.clipBounds != null){
                _local2.setLocation(this.clipBounds.getLocation());
            };
            _local2.setSize(_arg1);
            this.setClipBounds(_local2);
        }
        public function isFocusable():Boolean{
            return (this.focusable);
        }
        public function setFocusable(_arg1:Boolean):void{
            this.focusable = _arg1;
            this.getInternalFocusObject().tabEnabled = _arg1;
            this.setFocusableSet(true);
        }
        public function isFocusableSet():Boolean{
            return (this.focusableSet);
        }
        public function setFocusableSet(_arg1:Boolean):void{
            this.focusableSet = _arg1;
        }
        public function setDragEnabled(_arg1:Boolean):void{
            this.dragEnabled = _arg1;
        }
        public function isDragEnabled():Boolean{
            return (this.dragEnabled);
        }
        public function setDropTrigger(_arg1:Boolean):void{
            this.dropTrigger = _arg1;
        }
        public function isDropTrigger():Boolean{
            return (this.dropTrigger);
        }
        public function addDragAcceptableInitiator(_arg1:Component):void{
            if (this.dragAcceptableInitiator == null){
                this.dragAcceptableInitiator = new Dictionary(true);
            };
            this.dragAcceptableInitiator[_arg1] = true;
        }
        public function removeDragAcceptableInitiator(_arg1:Component):void{
            if (this.dragAcceptableInitiator != null){
                this.dragAcceptableInitiator[_arg1] = undefined;
                delete this.dragAcceptableInitiator[_arg1];
            };
        }
        public function setDragAcceptableInitiatorAppraiser(_arg1:Function):void{
            this.dragAcceptableInitiatorAppraiser = _arg1;
        }
        public function isDragAcceptableInitiator(_arg1:Component):Boolean{
            if (this.dragAcceptableInitiator != null){
                return ((this.dragAcceptableInitiator[_arg1] == true));
            };
            if (this.dragAcceptableInitiatorAppraiser != null){
                return (this.dragAcceptableInitiatorAppraiser(_arg1));
            };
            return (false);
        }
        public function setToolTipText(_arg1:String):void{
            this.toolTipText = _arg1;
            if (_arg1 == null){
                JSharedToolTip.getSharedInstance().unregisterComponent(this);
            } else {
                JSharedToolTip.getSharedInstance().registerComponent(this);
            };
        }
        public function getToolTipText():String{
            return (this.toolTipText);
        }
        protected function locate():void{
            var _local1:Number = this.getX();
            var _local2:Number = this.getY();
            this.d_x = _local1;
            this.d_y = _local2;
        }
        protected function set d_x(_arg1:Number):void{
            super.x = _arg1;
        }
        protected function set d_y(_arg1:Number):void{
            super.y = _arg1;
        }
        protected function get d_x():Number{
            return (super.x);
        }
        protected function get d_y():Number{
            return (super.y);
        }
        override public function set x(_arg1:Number):void{
            this.setX(_arg1);
        }
        override public function get x():Number{
            return (this.getX());
        }
        override public function set y(_arg1:Number):void{
            this.setY(_arg1);
        }
        override public function get y():Number{
            return (this.getY());
        }
        override public function set width(_arg1:Number):void{
            this.setWidth(_arg1);
        }
        override public function get width():Number{
            return (this.getWidth());
        }
        override public function set height(_arg1:Number):void{
            this.setHeight(_arg1);
        }
        override public function get height():Number{
            return (this.getHeight());
        }
        public function setAlignmentX(_arg1:Number):void{
            if (this.alignmentX != _arg1){
                this.alignmentX = _arg1;
                this.repaint();
            };
        }
        public function setAlignmentY(_arg1:Number):void{
            if (this.alignmentY != _arg1){
                this.alignmentY = _arg1;
                this.repaint();
            };
        }
        public function getAlignmentX():Number{
            return (this.alignmentX);
        }
        public function getAlignmentY():Number{
            return (this.alignmentY);
        }
        public function getClientProperty(_arg1, _arg2=undefined){
            if (this.clientProperty == null){
                return (_arg2);
            };
            if (this.clientProperty.containsKey(_arg1)){
                return (this.clientProperty.getValue(_arg1));
            };
            return (_arg2);
        }
        public function putClientProperty(_arg1, _arg2):void{
            if (this.clientProperty == null){
                this.clientProperty = new HashMap();
            };
            this.clientProperty.put(_arg1, _arg2);
        }
        protected function countMinimumSize():IntDimension{
            if (this.ui != null){
                return (this.ui.getMinimumSize(this));
            };
            return (this.getInsets().getOutsideSize(new IntDimension(0, 0)));
        }
        protected function countMaximumSize():IntDimension{
            if (this.ui != null){
                return (this.ui.getMaximumSize(this));
            };
            return (IntDimension.createBigDimension());
        }
        protected function countPreferredSize():IntDimension{
            if (this.ui != null){
                return (this.ui.getPreferredSize(this));
            };
            return (this.getSize());
        }
        public function setCachePreferSizes(_arg1:Boolean):void{
            this.cachePreferSizes = _arg1;
            if (!_arg1){
                this.cachedMaximumSize = null;
                this.cachedMinimumSize = null;
                this.cachedPreferredSize = null;
            };
        }
        public function isCachePreferSizes():Boolean{
            return (this.cachePreferSizes);
        }
        public function getMinimumSize():IntDimension{
            var _local1:IntDimension;
            if (this.isDirectReturnSize(this.minimumSize)){
                return (this.minimumSize.clone());
            };
            if (((this.isCachePreferSizes()) && (!((this.cachedMinimumSize == null))))){
                return (this.cachedMinimumSize.clone());
            };
            _local1 = this.mixSetSize(this.countMinimumSize(), this.minimumSize);
            if (this.isCachePreferSizes()){
                this.cachedMinimumSize = _local1;
                return (this.cachedMinimumSize.clone());
            };
            return (_local1);
        }
        public function getMaximumSize():IntDimension{
            var _local1:IntDimension;
            if (this.isDirectReturnSize(this.maximumSize)){
                return (this.maximumSize.clone());
            };
            if (((this.isCachePreferSizes()) && (!((this.cachedMaximumSize == null))))){
                return (this.cachedMaximumSize.clone());
            };
            _local1 = this.mixSetSize(this.countMaximumSize(), this.maximumSize);
            if (this.isCachePreferSizes()){
                this.cachedMaximumSize = _local1;
                return (this.cachedMaximumSize.clone());
            };
            return (_local1);
        }
        public function getPreferredSize():IntDimension{
            var _local1:IntDimension;
            if (this.isDirectReturnSize(this.preferredSize)){
                return (this.preferredSize.clone());
            };
            if (((this.isCachePreferSizes()) && (!((this.cachedPreferredSize == null))))){
                return (this.cachedPreferredSize.clone());
            };
            _local1 = this.mixSetSize(this.countPreferredSize(), this.preferredSize);
            if (this.isCachePreferSizes()){
                this.cachedPreferredSize = _local1;
                return (this.cachedPreferredSize.clone());
            };
            return (_local1);
        }
        private function isDirectReturnSize(_arg1:IntDimension):Boolean{
            return (((!((_arg1 == null))) && (((!((_arg1.width == -1))) && (!((_arg1.height == -1)))))));
        }
        private function mixSetSize(_arg1:IntDimension, _arg2:IntDimension):IntDimension{
            if (_arg2 != null){
                if (_arg2.width != -1){
                    _arg1.width = _arg2.width;
                } else {
                    if (_arg2.height != -1){
                        _arg1.height = _arg2.height;
                    };
                };
            };
            return (_arg1);
        }
        public function setMinimumSize(_arg1:IntDimension):void{
            if (_arg1 == null){
                this.minimumSize = null;
            } else {
                this.minimumSize = _arg1.clone();
            };
        }
        public function setMaximumSize(_arg1:IntDimension):void{
            if (_arg1 == null){
                this.maximumSize = null;
            } else {
                this.maximumSize = _arg1.clone();
            };
        }
        public function setPreferredSize(_arg1:IntDimension):void{
            if (_arg1 == null){
                this.preferredSize = null;
            } else {
                this.preferredSize = _arg1.clone();
            };
        }
        public function getPreferredWidth():int{
            return (this.getPreferredSize().width);
        }
        public function setPreferredWidth(_arg1:int):void{
            if (this.preferredSize == null){
                this.preferredSize = new IntDimension(-1, -1);
            };
            this.preferredSize.width = _arg1;
        }
        public function getPreferredHeight():int{
            return (this.getPreferredSize().height);
        }
        public function setPreferredHeight(_arg1:int):void{
            if (this.preferredSize == null){
                this.preferredSize = new IntDimension(-1, -1);
            };
            this.preferredSize.height = _arg1;
        }
        public function getMaximumWidth():int{
            return (this.getMaximumSize().width);
        }
        public function setMaximumWidth(_arg1:int):void{
            if (this.maximumSize == null){
                this.maximumSize = new IntDimension(-1, -1);
            };
            this.maximumSize.width = _arg1;
        }
        public function getMaximumHeight():int{
            return (this.getMaximumSize().height);
        }
        public function setMaximumHeight(_arg1:int):void{
            if (this.maximumSize == null){
                this.maximumSize = new IntDimension(-1, -1);
            };
            this.maximumSize.height = _arg1;
        }
        public function getMinimumWidth():int{
            return (this.getMinimumSize().width);
        }
        public function setMinimumWidth(_arg1:int):void{
            if (this.minimumSize == null){
                this.minimumSize = new IntDimension(-1, -1);
            };
            this.minimumSize.width = _arg1;
        }
        public function getMinimumHeight():int{
            return (this.getMinimumSize().height);
        }
        public function setMinimumHeight(_arg1:int):void{
            if (this.minimumSize == null){
                this.minimumSize = new IntDimension(-1, -1);
            };
            this.minimumSize.height = _arg1;
        }
        public function hitTestMouse():Boolean{
            if (this.isOnStage()){
                return (hitTestPoint(stage.mouseX, stage.mouseY, false));
            };
            return (false);
        }
        public function revalidate():void{
            this.invalidate();
            RepaintManager.getInstance().addInvalidComponent(this);
        }
        public function revalidateIfNecessary():void{
            RepaintManager.getInstance().addInvalidComponent(this);
        }
        public function repaint():void{
            if (((this.isVisible()) && (this.isReadyToPaint()))){
                RepaintManager.getInstance().addRepaintComponent(this);
            };
        }
        public function repaintAndRevalidate():void{
            this.repaint();
            this.revalidate();
        }
        protected function size():void{
            this.readyToPaint = true;
            this.repaint();
            this.invalidate();
        }
        public function invalidate():void{
            this.invalidateTree();
            this.invalidatePreferSizeCaches();
        }
        protected function invalidateTree():void{
            this.valid = false;
            var _local1:Component = this.getParent();
            if (((!((_local1 == null))) && (_local1.isValid()))){
                _local1.invalidateTree();
            };
        }
        public function invalidatePreferSizeCaches():void{
            this.clearPreferSizeCaches();
            var _local1:Container = this.getParent();
            if (_local1 != null){
                _local1.invalidatePreferSizeCaches();
            };
        }
        protected function clearPreferSizeCaches():void{
            this.cachedMaximumSize = null;
            this.cachedMinimumSize = null;
            this.cachedPreferredSize = null;
        }
        public function validate():void{
            if (!this.valid){
                this.valid = true;
            };
        }
        public function paintImmediately():void{
            var _local1:IntRectangle;
            if (((this.isVisible()) && (this.isReadyToPaint()))){
                _local1 = this.getPaintBoundsInRoot();
                this.layoutClipAndTrigger(null);
                this.paint(this.getInsets().getInsideBounds(_local1));
            };
        }
        private function isReadyToPaint():Boolean{
            return (this.readyToPaint);
        }
        protected function paint(_arg1:IntRectangle):void{
            graphics.clear();
            var _local2:Graphics2D = new Graphics2D(graphics);
            if (((this.isEnabled()) && (this.drawTransparentTrigger))){
                _local2.fillRectangle(bg_trigger_brush, _arg1.x, _arg1.y, _arg1.width, _arg1.height);
            };
            if (this.backgroundDecorator != null){
                this.backgroundDecorator.updateDecorator(this, _local2, _arg1.clone());
            };
            if (this.ui != null){
                this.ui.paint(this, _local2, _arg1.clone());
            };
            this.paintFocusRect();
            if (this.border != null){
                this.border.updateBorder(this, _local2, this.getInsets().getOutsideBounds(_arg1.clone()));
            };
            if (this.foregroundDecorator != null){
                this.foregroundDecorator.updateDecorator(this, _local2, _arg1.clone());
            };
            dispatchEvent(new AWEvent(AWEvent.PAINT, false, false));
        }
        public function paintFocusRect(_arg1:Boolean=false):void{
            var _local3:Sprite;
            var _local2:FocusManager = FocusManager.getManager(stage);
            if (((this.ui) && (_local2))){
                if (((_arg1) || (((_local2.isTraversing()) && (this.isFocusOwner()))))){
                    _local3 = _local2.moveFocusRectUpperTo(this);
                    _local3.graphics.clear();
                    this.ui.paintFocus(this, new Graphics2D(_local3.graphics), new IntRectangle(0, 0, this.width, this.height));
                };
            };
        }
        private function layoutClipAndTrigger(_arg1:IntRectangle):void{
            var _local2:IntRectangle;
            var _local3:IntRectangle;
            var _local4:int;
            var _local5:int;
            var _local6:int;
            var _local7:int;
            if (_arg1 == null){
                _local2 = new IntRectangle(0, 0, this.width, this.height);
                _local3 = this.getPaintBoundsInRoot();
                _local4 = Math.max(_local2.x, _local3.x);
                _local5 = Math.min((_local2.x + _local2.width), (_local3.x + _local3.width));
                _local6 = Math.max(_local2.y, _local3.y);
                _local7 = Math.min((_local2.y + _local2.height), (_local3.y + _local3.height));
                _arg1 = new IntRectangle(_local4, _local6, (_local5 - _local4), (_local7 - _local6));
            } else {
                _arg1 = _arg1.clone();
            };
            if (this.clipBounds != null){
                _arg1.x = Math.max(_arg1.x, this.clipBounds.x);
                _arg1.y = Math.max(_arg1.y, this.clipBounds.y);
                _arg1.width = Math.min(_arg1.width, this.clipBounds.width);
                _arg1.height = Math.min(_arg1.height, this.clipBounds.height);
            };
            setClipMaskRect(_arg1);
        }
        private function getPaintBoundsInRoot():IntRectangle{
            var _local1:IntDimension = this.getMinimumSize();
            var _local2:IntDimension = this.getMaximumSize();
            var _local3:IntDimension = this.getSize();
            var _local4:IntRectangle = new IntRectangle(0, 0, _local3.width, _local3.height);
            if (_local3.width > _local2.width){
                _local4.width = _local2.width;
                _local4.x = ((_local3.width - _local4.width) * this.getAlignmentX());
            };
            if (_local3.height > _local2.height){
                _local4.height = _local2.height;
                _local4.y = ((_local3.height - _local4.height) * this.getAlignmentY());
            };
            if (_local4.width < _local1.width){
                _local4.width = _local1.width;
            };
            if (_local4.height < _local1.height){
                _local4.height = _local1.height;
            };
            return (_local4);
        }
        public function isValid():Boolean{
            return (this.valid);
        }
        public function isValidateRoot():Boolean{
            if (((!((stage == null))) && ((this.getParent() == null)))){
                return (true);
            };
            return (false);
        }
        public function getParent():Container{
            return (this.container);
        }
        public function reAppendToParent(_arg1:Object=null):void{
            var _local2:int;
            var _local3:Container;
            if (this.container){
                _local2 = this.container.getIndex(this);
                _local3 = this.container;
                _local3.remove(this);
                _local3.insert(_local2, this, _arg1);
            };
        }
        public function parentReAppendChildren():void{
            if (this.container){
                this.container.reAppendChildren();
            };
        }
        public function getRootPaneAncestor():JRootPane{
            var _local1:DisplayObject = parent;
            while (_local1 != null) {
                if ((_local1 is JRootPane)){
                    return ((_local1 as JRootPane));
                };
                _local1 = _local1.parent;
            };
            return (null);
        }
        public function getKeyboardManager():KeyboardManager{
            var _local1:JRootPane = this.getRootPaneAncestor();
            if (_local1){
                return (_local1.getKeyboardManager());
            };
            return (null);
        }
        public function removeFromContainer():void{
            if (this.getParent() != null){
                this.getParent().remove(this);
            };
            if (parent != null){
                parent.removeChild(this);
            };
        }
        public function setConstraints(_arg1:Object):void{
            this.constraints = _arg1;
        }
        public function getConstraints():Object{
            return (this.constraints);
        }
        public function transferFocus():Boolean{
            return (this.transferFocusWithDirection(1));
        }
        public function transferFocusBackward():Boolean{
            return (this.transferFocusWithDirection(-1));
        }
        private function transferFocusWithDirection(_arg1:Number):Boolean{
            var _local3:Component;
            var _local2:Container = this.getParent();
            if (_local2 == null){
                _local2 = (this as Container);
            };
            if (_local2 != null){
                _local3 = null;
                if (_arg1 > 0){
                    _local3 = _local2.getFocusTraversalPolicy().getComponentAfter(this);
                } else {
                    _local3 = _local2.getFocusTraversalPolicy().getComponentBefore(this);
                };
                if (_local3 != null){
                    return (_local3.requestFocus());
                };
            };
            return (false);
        }
        public function isFocusOwner():Boolean{
            var _local1:FocusManager = FocusManager.getManager(stage);
            return (((!((_local1 == null))) && ((_local1.getFocusOwner() == this))));
        }
        public function requestFocus():Boolean{
            if (((((((this.isFocusable()) || (!((this.getFocusTransmit() == null))))) && (this.isEnabled()))) && (this.isShowing()))){
                this.makeFocus();
                return (true);
            };
            return (false);
        }
        public function makeFocus():void{
            var _local1:InteractiveObject;
            if (this.getFocusTransmit() != null){
                this.getFocusTransmit().requestFocus();
            } else {
                _local1 = this.getInternalFocusObject();
                if (_local1 != stage.focus){
                    stage.focus = _local1;
                };
            };
        }
        public function getInternalFocusObject():InteractiveObject{
            var _local1:InteractiveObject;
            if (this.ui != null){
                _local1 = this.ui.getInternalFocusObject(this);
            };
            if (_local1 != null){
                return (_local1);
            };
            return (this);
        }
        public function getFocusManager():FocusManager{
            return (FocusManager.getManager(stage));
        }
        function fireFocusKeyDownEvent(_arg1:KeyboardEvent):void{
            dispatchEvent(new FocusKeyEvent(FocusKeyEvent.FOCUS_KEY_DOWN, _arg1.charCode, _arg1.keyCode, _arg1.keyLocation, _arg1.ctrlKey, _arg1.altKey, _arg1.shiftKey));
        }
        function fireFocusKeyUpEvent(_arg1:KeyboardEvent):void{
            dispatchEvent(new FocusKeyEvent(FocusKeyEvent.FOCUS_KEY_UP, _arg1.charCode, _arg1.keyCode, _arg1.keyLocation, _arg1.ctrlKey, _arg1.altKey, _arg1.shiftKey));
        }
        private function fireDragRecognizedEvent(_arg1:Component):void{
            dispatchEvent(new DragAndDropEvent(DragAndDropEvent.DRAG_RECOGNIZED, this, null, new IntPoint(stage.mouseX, stage.mouseY)));
        }
        public function fireDragEnterEvent(_arg1:Component, _arg2:SourceData, _arg3:IntPoint, _arg4:Component):void{
            dispatchEvent(new DragAndDropEvent(DragAndDropEvent.DRAG_ENTER, _arg1, _arg2, _arg3, this, _arg4));
        }
        public function fireDragOverringEvent(_arg1:Component, _arg2:SourceData, _arg3:IntPoint):void{
            dispatchEvent(new DragAndDropEvent(DragAndDropEvent.DRAG_OVERRING, _arg1, _arg2, _arg3, this));
        }
        public function fireDragExitEvent(_arg1:Component, _arg2:SourceData, _arg3:IntPoint, _arg4:Component):void{
            dispatchEvent(new DragAndDropEvent(DragAndDropEvent.DRAG_EXIT, _arg1, _arg2, _arg3, this, _arg4));
        }
        public function fireDragDropEvent(_arg1:Component, _arg2:SourceData, _arg3:IntPoint):void{
            dispatchEvent(new DragAndDropEvent(DragAndDropEvent.DRAG_DROP, _arg1, _arg2, _arg3, this));
        }
        private function __mouseClick(_arg1:MouseEvent):void{
            var _local2:int = getTimer();
            var _local3:IntPoint = this.getMousePosition();
            if (((_local3.equals(this._lastClickPoint)) && (((_local2 - this.lastClickTime) < MAX_CLICK_INTERVAL)))){
                this.clickCount++;
            } else {
                this.clickCount = 1;
            };
            this.lastClickTime = _local2;
            dispatchEvent(new ClickCountEvent(ClickCountEvent.CLICK_COUNT, this.clickCount));
            this._lastClickPoint = _local3;
        }
        private function __mouseDown(_arg1:MouseEvent):void{
            this.checkRequestFocusWhenMouseDown(_arg1);
            if (this.isDragEnabled()){
                addEventListener(MouseEvent.MOUSE_MOVE, this.__mouseMove);
                addEventListener(MouseEvent.ROLL_OUT, this.__rollOut);
                stage.addEventListener(MouseEvent.MOUSE_UP, this.__mouseUp, false, 0, true);
                this.pressingPoint = this.getMousePosition();
            };
        }
        protected function getFocusTransmit():Component{
            return (null);
        }
        private function checkRequestFocusWhenMouseDown(_arg1:MouseEvent):void{
            var _local5:InteractiveObject;
            var _local6:Component;
            if (!((((this.isFocusable()) || (!((this.getFocusTransmit() == null))))) && (this.isEnabled()))){
                return;
            };
            var _local2:FocusManager = FocusManager.getManager(stage);
            if (_local2 == null){
                return;
            };
            var _local3:Component = _local2.getFocusOwner();
            var _local4:DisplayObject = (_arg1.target as DisplayObject);
            if (_local3 == null){
                _local5 = null;
                if (stage != null){
                    _local5 = stage.focus;
                };
                if (_local5 == null){
                    this.requestFocus();
                } else {
                    if (!contains(_local5)){
                        this.requestFocus();
                    };
                };
            } else {
                if (_local3 == this){
                } else {
                    if (!AsWingUtils.isAncestor(this, _local3)){
                        this.requestFocus();
                    } else {
                        if (_local3.contains(_local4)){
                        } else {
                            _local6 = AsWingUtils.getOwnerComponent(_local4);
                            if (_local6 == this){
                                this.requestFocus();
                            } else {
                                if (!AsWingUtils.isAncestorComponent(this, _local6)){
                                    this.requestFocus();
                                };
                            };
                        };
                    };
                };
            };
        }
        private function __mouseUp(_arg1:MouseEvent):void{
            this.stopListernDragRec();
        }
        private function __mouseMove(_arg1:MouseEvent):void{
            var _local2:IntPoint = this.getMousePosition();
            if (_local2.distanceSq(this.pressingPoint) > 1){
                this.fireDragRecognizedEvent(null);
                this.stopListernDragRec();
            };
        }
        private function __rollOut(_arg1:MouseEvent):void{
            this.stopListernDragRec();
        }
        private function stopListernDragRec():void{
            removeEventListener(MouseEvent.MOUSE_MOVE, this.__mouseMove);
            removeEventListener(MouseEvent.ROLL_OUT, this.__rollOut);
            stage.removeEventListener(MouseEvent.MOUSE_UP, this.__mouseUp);
        }
        private function __focusIn(_arg1:FocusEvent):void{
            var _local2:FocusManager;
            var _local3:Component;
            if ((((_arg1.target == this.getInternalFocusObject())) && (this.isFocusable()))){
                _local2 = FocusManager.getManager(stage);
                if (_local2 == null){
                    return;
                };
                _local3 = _local2.getFocusOwner();
                if (this != _local3){
                    _local2.setFocusOwner(this);
                    this.paintFocusRect();
                    dispatchEvent(new AWEvent(AWEvent.FOCUS_GAINED));
                };
            };
        }
        private function __focusOut(_arg1:FocusEvent):void{
            var _local2:FocusManager;
            var _local3:Component;
            if ((((_arg1.target == this.getInternalFocusObject())) && (this.isFocusable()))){
                _local2 = FocusManager.getManager(stage);
                if (_local2 == null){
                    return;
                };
                _local3 = _local2.getFocusOwner();
                if (this == _local3){
                    _local2.setFocusOwner(null);
                    dispatchEvent(new AWEvent(AWEvent.FOCUS_LOST));
                };
            };
        }
        override public function toString():String{
            return ((((Reflection.getClassName(this) + "[asset:") + super.toString()) + "]"));
        }

    }
}//package org.aswing 
